package bishiqiangxunday20;
import java.util.*;
public class Test1 {
    //题目:经此一役小红所向无敌  笔试强训day20第一题
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        //先输入
        long a = in.nextLong();
        long h = in.nextLong();
        long b = in.nextLong();
        long k = in.nextLong();

        long num = fun(a,h,b,k);
        System.out.println(num);

    }

    public static long fun(long a,long h,long b,long k) {
        long sum = 0;  //记录一下小红受的伤害
        while(h > 0 && k > 0) {
            //光先攻击小红
            sum += b;
            //对立攻击小红
            sum += a;

            //小红让他们互相攻击
            h -= b;
            k -= a;
            if(h <=0 || k <= 0) {
                break;
            }
        }

        //有一个人死了 会自爆
        if(h <= 0 && k >0) {
            //光活着  对立死了
            sum += b*10;
        }else if(h > 0 && k <= 0) {
            sum += a * 10;
        }

        return sum;
    }

}
